﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript">

        window.onload = function () {
            //表单验证
            document.getElementById("myForm").addEventListener("submit", function () {
                alert(this.checkValidity());
            }, false)

            //novalidate特性:禁用验证
        }


    </script>
</head>
<body>
    <form id="myForm" name="myForm" novalidate>
        <div>
            <table>
                <tr>
                    <td>必填字段</td>
                    <td><input type="text" required value="123" /></td>
                </tr>
                <tr>
                    <td>email</td>
                    <td><input type="email" value="123@163.com" /></td>
                </tr>
                <tr>
                    <td>url</td>
                    <td><input type="url" value="http://www.baidu.com" /></td>
                </tr>
                <tr>
                    <td>number:min和max属性</td>
                    <td><input type="number" min="0" max="100" /></td>
                </tr>
            </table>
        </div>
        <input type="submit" value="提交" />
    </form>
</body>
</html>
